package ru.tulupov.collectionsbenchmark.test;

import ru.tulupov.collectionsbenchmark.Test;
import ru.tulupov.collectionsbenchmark.model.Car;
import ru.tulupov.collectionsbenchmark.model.CarHeightComparator;
import ru.tulupov.collectionsbenchmark.model.CarWidthComparator;
import ru.tulupov.collectionsbenchmark.tester.ArrayListTester;
import ru.tulupov.collectionsbenchmark.tester.HashSetTester;
import ru.tulupov.collectionsbenchmark.tester.LinkedListTester;
import ru.tulupov.collectionsbenchmark.tester.Tester;
import ru.tulupov.collectionsbenchmark.tester.TreeSetTester;

@Test(name = "Sequental access")
public class SequentalAccessTestSuite extends AbstractTest {
	private Tester<Car> arrayListTester;
	private Tester<Car> linkedListTester;
	private Tester<Car> hashSetTester;
	private Tester<Car> treeSetTester;
	private Tester<Car> treeSetTesterByWidth;
	private Tester<Car> treeSetTesterByHeight;

	public SequentalAccessTestSuite() {
		this.arrayListTester = new ArrayListTester<Car>();
		this.linkedListTester = new LinkedListTester<Car>();
		this.hashSetTester = new HashSetTester<Car>();
		this.treeSetTester = new TreeSetTester<Car>();
		this.treeSetTesterByWidth = new TreeSetTester<Car>(
				new CarWidthComparator());
		this.treeSetTesterByHeight = new TreeSetTester<Car>(
				new CarHeightComparator());

		arrayListTester.init(cars);
		linkedListTester.init(cars);
		hashSetTester.init(cars);
		treeSetTester.init(cars);
		treeSetTesterByWidth.init(cars);
		treeSetTesterByHeight.init(cars);
	}

	@Test
	public void arrayListTest() {
		arrayListTester.sequentialAccess();
	}

	@Test
	public void linkedListTest() {
		linkedListTester.sequentialAccess();
	}

	@Test
	public void hashSetTest() {
		hashSetTester.sequentialAccess();
	}

	@Test
	public void treeSetTest() {
		treeSetTester.sequentialAccess();
	}

	@Test
	public void treeSetByWidthTest() {
		treeSetTesterByWidth.sequentialAccess();
	}

	@Test
	public void treeSetByHeightTest() {
		treeSetTesterByHeight.sequentialAccess();
	}
}
